import request from '@/config/axios'

// 司机培训课程 VO
export interface TrainingVO {
  id: number // 主键
  driverId: number // 关联 id
  courseName: string // 驾驶员培训课程名称
  trainingDate: Date // 培训课程日期
  startDate: Date // 培训开始日期
  endDate: Date // 培训结束日期
  durationMinutes: number // 培训时长（分钟）
}

// 司机培训课程 API
export const TrainingApi = {
  // 查询司机培训课程分页
  getTrainingPage: async (params: any) => {
    return await request.get({ url: `/ride/training/page`, params })
  },

  // 查询司机培训课程详情
  getTraining: async (id: number) => {
    return await request.get({ url: `/ride/training/get?id=` + id })
  },

  // 新增司机培训课程
  createTraining: async (data: TrainingVO) => {
    return await request.post({ url: `/ride/training/create`, data })
  },

  // 修改司机培训课程
  updateTraining: async (data: TrainingVO) => {
    return await request.put({ url: `/ride/training/update`, data })
  },

  // 删除司机培训课程
  deleteTraining: async (id: number) => {
    return await request.delete({ url: `/ride/training/delete?id=` + id })
  },

  // 导出司机培训课程 Excel
  exportTraining: async (params) => {
    return await request.download({ url: `/ride/training/export-excel`, params })
  },
}